import routerMap from './router.map'
import {
	parseRoutes
} from '@/utils/routerUtil'
// 异步路由配置
//应用配置
let obj = localStorage.getItem("routesConfig")
let obv = {}
if (obj) {
	obv = {
		router: JSON.parse(obj).router,
		children: JSON.parse(obj).children
	}
	console.log("123", obv);
} else {
	obv = {
		children: [
			{
				children: ['workplace', 'analysis'],
				router: 'dashboard',
			}, //推广平台
			{
				children: ['approval', 'member', 'account', 'personal'],
				router: 'extension',
			}, //推广管理
			{
				children: ['OrderList', 'OverdueList'],
				router: 'order'
			}, //订单管理
			{
				children: ['goods'],
				router: 'goods',
			}, //选品选类
			{
				children: ['my', 'withdraw', 'withdrawal', 'settlement'],
				router: 'account',
			}, //财务管理
		],
		router: "root"
	}
}
const routesConfig = [
	'login',
	// 'root',
	{
		router: 'exp404',
		path: '*',
		name: '404'
	},
	{
		router: 'exp403',
		path: '/403',
		name: '403'
	},
	obv
	// obv

]

const options = {
	routes: parseRoutes(routesConfig, routerMap)
}

export default options
